package com.geor.gcv.core.process;

import org.opencv.core.Core;
import org.opencv.core.Mat;

/**
 * 降低图亮度
 * 
 * @author geor.lusongnan
 *
 */
public class BrightnessProcess extends Process {
	private Process chain;
	private double alpha = 1.0;

	public BrightnessProcess(Process chain, double alpha) {
		this.chain = chain;
		this.alpha = alpha;
	}

	public BrightnessProcess() {
	}

	@Override
	public Mat process() {
		Mat mat = chain.process();
		Mat black = Mat.eye(mat.size(), mat.type());
		Mat result = new Mat();
		Core.scaleAdd(mat, alpha, black, result);
		return result;
	}

	@Override
	public String getProcessName() {
		return chain.getProcessName() + ",图片相加处理";
	}

	protected void setChain(Process chain) {
		this.chain = chain;
	}

	protected void setAlpha(double alpha) {
		this.alpha = alpha;
	}

}
